<!--

/*
* Copyright (C) 2005-2013 University of Sydney
*
* Licensed under the GNU License, Version 3.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/gpl-3.0.txt
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/


/**
*  Popup for bulk setting of ownership and visibility on selected set of records
*
* @author      Tom Murtagh
* @author      Kim Jackson
* @author      Ian Johnson   <ian.johnson@sydney.edu.au>
* @author      Stephen White   <stephen.white@sydney.edu.au>
* @author      Artem Osmakov   <artem.osmakov@sydney.edu.au>
* @copyright   (C) 2005-2013 University of Sydney
* @link        http://Sydney.edu.au/Heurist
* @version     3.1.0
* @license     http://www.gnu.org/licenses/gpl-3.0.txt GNU License 3.0
* @package     Heurist academic knowledge management system
* @subpackage  !!!subpackagename for file such as Administration, Search, Edit, Application, Library
*/


-->
<html>
	<head>
		<link rel=stylesheet href="../../common/css/global.css">
		<title>Set Workgroup/Visibility</title>

		<style>
			body { font-size: 11px; }
			#non-wg-view { margin-bottom: 5px; }
		</style>

		<script src="../../external/jquery/jquery.js"></script>
		<script>
			$(document).ready(function() {
				$("#wg-select").append("<option value=\"" + top.HEURIST.get_user_id() + "\">" + top.HEURIST.get_user_name() + "</option>");
				for (var i = 0; i < top.HEURIST.user.workgroups.length; ++i) {
					var wg = top.HEURIST.user.workgroups[i];
					var name = top.HEURIST.workgroups[wg].name;
					$("#wg-select").append("<option value=\"" + wg + "\">" + name + "</option>");
				}
			});
		</script>

	</head>

	<body width=500 height=220>

		<table cellspacing=10>
			<tr>
				<td nowrap>Records are editable by :</td>
				<td>
					<select id=wg-select>
						<option value="-1" selected="selected">please select ...</option>
						<option value="0">Any logged-in user (no restriction)</option>
					</select>
				</td>
			</tr>

			<tr>
				<td valign="top">Record is visible to :</td>
				<td>
					<label for=non-wg-hide><input type=radio name=non-wg-vis id=non-wg-hide> Members of this group / this user only</label>
					<br>&nbsp;<br>
					<label for=non-wg-view><input type=radio name=non-wg-vis id=non-wg-view checked> Logged in users only</label>
					<br>&nbsp;<br>
					<label for=non-wg-pending><input type=radio name=non-wg-vis id=non-wg-pending> Logged-in users, marked for potential external publish</label>
					<br>&nbsp;<br>
					<label for=non-wg-public><input type=radio name=non-wg-vis id=non-wg-public> Anyone (automatic external publish, except restricted fields)</label>
					<!-- 12/9/11 this was non-wg-pub, which looks like an error to me -->
				</td>
			</tr>

			<tr><td colspan=2></td></tr>

			<tr>
				<td colspan=2 style="width: 100%; text-align: right;">
					<!-- TODO: we should check that a value has been selected
					TODO: ideally, if all the records have the same group and/or non-owner-visibility, this should be set as the value for radio box and pulldown -->
					<input type=submit value=save onclick="window.close( $('#wg-select').val(), $('#non-wg-view')[0].checked, $('#non-wg-hide')[0].checked, $('#non-wg-pending')[0].checked );">
					<input type=submit value=cancel onclick="window.close();">
				</td>
			</tr>
		</table>

	</body>

</html>

